<template>
  <el-container>
    <div class="c1">
      <el-form
        :inline="true"
        :model="searchData"
        :rules="rules"
        ref="searchData"
        class="demo-form-inline s1"
      >
        <el-form-item label="员工姓名" prop="empName">
          <el-input class="search_inp" v-model="empName" placeholder="输入员工姓名查询"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="mini" type="success" icon="el-icon-search" @click="getEmpList">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-card class="c2">
      <el-table
        :data="empList"
        style="width: 100%"
        max-height="400"
        align="center"
        stripe
        v-loading="loading"
        row-key="empId"
        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      >
        <el-table-column type="index" width="50" label="序号"></el-table-column>
        <el-table-column prop="name" width="80" label="员工姓名"></el-table-column>
        <el-table-column prop="birth" width="80" label="员工生日"></el-table-column>
        <el-table-column prop="identityType" width="120" label="员工身份证类型"></el-table-column>
        <el-table-column prop="identity" width="140" label="员工身份证号码"></el-table-column>
        <el-table-column prop="phone" width="80" label="员工联系电话"></el-table-column>
        <el-table-column prop="dept" width="120" label="所属部门"></el-table-column>
        <el-table-column prop="post" width="120" label="担任职务"></el-table-column>
        <el-table-column prop="enter_date" width="120" label="入行日期"></el-table-column>
        <el-table-column width="120" label="操作" style="text-align:center">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-edit"
              @click="handleEdit(scope.row)"
            >手动分配</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <el-dialog title="手动分配营销经理" :visible.sync="editmenuDialogVisible" width="65%">
      <el-row style="text-align:center">
        选定营销网点：
        <el-select
          v-model="departmentId"
          placeholder="请选择营销网点"
          @change="getSysUserListBydepartmentId"
        >
          <el-option
            v-for="(item, index) in bankList"
            :label="item.name"
            :value="item.id"
            :key="index"
          ></el-option>
        </el-select>
      </el-row>
      <el-row style="text-align:center">
        选定营销经理：
        <el-select v-model="sysUserName" placeholder="请选择营销经理">
          <el-option
            v-for="(item, index) in sysUserList"
            :label="item.userName"
            :value="item.userName"
            :key="index"
          ></el-option>
        </el-select>
      </el-row>
      <el-button @click="getSysUserListBydepartmentId">手动获取管户列表</el-button>
      <span slot="footer" class="dialog-footer">
        <el-button @click="editmenuDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="allocateAndSave">确 定</el-button>
      </span>
    </el-dialog>

    <el-footer v-if="searchToggle">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="this.pageNum.currentPage"
        :page-sizes="[10, 20, 30, 50]"
        :page-size="this.pageNum.perPage_size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="this.pageNum.total"
      ></el-pagination>
    </el-footer>
  </el-container>
</template>

<script>
import axios from "../../utils/axios";
export default {
  data() {
    return {
      pageNum: {
        current: 1,
        size: 10,
        total: 0
      },
      loading: false,
      searchData: {
        name: "张三"
      },
      rules: {
        name: [
          { required: true, message: "请输入员工姓名", trigger: "blur" },
          { min: 2, message: "长度在 2 个字符以上", trigger: "blur" }
        ]
      },
      empList: [],
      empName: "",
      tableData: [],
      searchToggle: true,
      editmenuDialogVisible: false,
      enterpriseId: "",
      departmentId: "",
      sysUserName: "zgc",
      bankList: [],
      sysUserList: []
    };
  },
  methods: {
    handleSizeChange() {},
    handleCurrentChange() {},
    //1.点击搜索获取员工列表
    getEmpList() {
      alert("去获取-->");
      axios({
        method: "GET",
        url: "/bank/emp/getList/" + this.empName
      }).then(res => {
        this.empList = res;
      });
    }
  }
};
</script>
<style lang="less" scoped>
.c1 {
  display: flex;
  justify-content: start;
  margin-bottom: 1.5rem;
  width: 100%;
  .dBtn {
    margin-right: 1rem;
  }
}

.el-input /deep/.el-input__inner {
  height: 3.05rem;
  font-size: 12px !important;
}
</style>